package com.bsoft.hospitalchs.common;

import android.app.Application;
import android.content.Context;

import com.bsoft.hospitalchs.utils.LogUtil;
import com.bsoft.hospitalchs.utils.SpUtils;
import com.socks.library.KLog;

/**
 * Created by 泅渡者
 * Created on 2017/3/22.
 */
public class MyApplication extends Application {

    private static MyApplication instance;
    public static Context myContext;
    public boolean isRemember;
    public String ipconfig;
    public String Base_url;

    public String getBase_url() {
        return "http://" + getIpconfig() + "/phis/";
    }

    //    public static final String BASE_URL = "http://192.168.0.249:8089/phis/";
//    public static final String BASE_URL = "http://219.234.5.196:8087/phis/";//外网服务器地址
//    public static final String BASE_URL = "http://192.168.0.40:8880/phis/";
    public String getIpconfig() {
        return (String) SpUtils.get(myContext, "Ipconfig", "219.234.5.196:8087");
    }

    public void setIpconfig(String ipconfig) {
        SpUtils.put(myContext, "Ipconfig", ipconfig);
    }


    public static boolean isRemember() {
        return (boolean) SpUtils.get(myContext, "IsRemember", false);
    }

    public static void setIsRemember(boolean isRemember) {
        SpUtils.put(myContext, "IsRemember", isRemember);
    }

    public static MyApplication getInstance() {
        return instance;
    }

    @Override
    public void onCreate() {
        super.onCreate();
        instance = this;
        LogUtil.setDebug(true);
        myContext = this.getApplicationContext();
        KLog.init(true);

    }
}
